import api from "../../utils/modules/api";
export const Base = {
  state: {
    tasksConfig: {},
  },
  actions: {
    getTasksConfigData(store, json) {
      return new Promise((resolve, reject) => {
        api
          .get("/task/config", json)
          .then((res) => {
            resolve(res.data);
          })
          .catch((err) => {
            reject(err);
          });
      });
    },
    getNodeBaseComponentInitData(store, json) {
      return new Promise((resolve, reject) => {
        api
          .get("/node/initData", json)
          .then((res) => {
            resolve(res.data);
          })
          .catch((err) => {
            reject(err);
          });
      });
    },
    submitFormData(store, json) {
      return new Promise((resolve, reject) => {
        api
          .post("/node/submitFormData", json)
          .then((res) => {
            resolve(res.data);
          })
          .catch((err) => {
            reject(err);
          });
      });
    },
    saveFormData(store, json) {
      return new Promise((resolve, reject) => {
        api
          .put("/node/saveFormData", json)
          .then((res) => {
            resolve(res.data);
          })
          .catch((err) => {
            reject(err);
          });
      });
    },
    cancelFormData(store, json) {
      return new Promise((resolve, reject) => {
        api
          .post("/node/cancelFormData", json)
          .then((res) => {
            resolve(res.data);
          })
          .catch((err) => {
            reject(err);
          });
      });
    },
    deleteFormData(store, json) {
      return new Promise((resolve, reject) => {
        api
          .delete("/node/deleteFormData", json)
          .then((res) => {
            resolve(res.data);
          })
          .catch((err) => {
            reject(err);
          });
      });
    },
    searchFormData(store, json) {
      return new Promise((resolve, reject) => {
        api
          .delete("/node/searchFormData", json)
          .then((res) => {
            resolve(res.data);
          })
          .catch((err) => {
            reject(err);
          });
      });
    },
  },
  mutations: {},
};
